%{

#include <stdio.h>

#include "parser.h"

#define YY_NO_UNISTD_H
#define YY_SKIP_YYWRAP

extern int lineNo;
int yywrap();
void yyerror(char *err);

int isatty(int) {return 0;}

%}

delim				[ \t\r]
whitespace			{delim}+


nr_decimal			[1-9][0-9]*
nr_octal			[0-7]+
nr_hexa				"0x"[0-9a-fA-F]+
nr_binary			"0b"[0-1]+

ident_start			[a-zA-Z]
ident_body			[a-zA-Z0-9]
identifier			{ident_start}{ident_body}*


%%
"\n"				{lineNo++;}
{whitespace}		{/*ignore whitespace*/}

"void"				{return TYPE_VOID;}
"char"				{return TYPE_CHAR;}
"short"				{return TYPE_SHORT;}
"long"				{return TYPE_LONG;}
"int"				{return TYPE_INT;}
"signed"			{return TYPE_SIGNED;}
"unsigned"			{return TYPE_UNSIGNED;}



{identifier}		{return IDENTIFIER;}
{nr_decimal}		{yylval.iValue = atoi(yytext); return NUMBER;}

.							{return yytext[0];}



%%
